import fs
import syscall

fn main():void! {
    var f = fs.open('./test.txt', syscall.O_RDONLY, 0)

    var buf = vec_new<u8>(0, 50)

    println(buf.len(), buf.cap())
    var len = f.read(buf)
    println('first read test.txt data:', len, buf as string)

    len = f.read(buf)
    println('second read test.txt data:', len, buf as string)

    len = f.read(buf)
    if len == 0 {
        println('read completed')
    }
}